/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package embeddedpaint.user_interface.tools.dialog.chooser;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Frame;
import java.awt.GraphicsEnvironment;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Label;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.ActionMap;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.InputMap;
import javax.swing.JButton;
import javax.swing.JColorChooser;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.KeyStroke;
import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities;
import javax.swing.border.Border;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.JTextComponent;
import javax.swing.text.Position;
import sun.util.BuddhistCalendar;


public class JFontChooser extends JComponent 
{
    public static final int         OK_OPTION                   = 0;
    public static final int         CANCEL_OPTION               = 1;
    public static final int         ERROR_OPTION                = -1;
    
    private static final Font       DEFAULT_FONT                = new Font("Dialog", Font.PLAIN, 12);
    private static final int[]      FONT_STYLE_CODES            = { Font.PLAIN, Font.BOLD, Font.ITALIC, Font.BOLD | Font.ITALIC };
    private static final String[]   DEFAULT_FONT_SIZE_STRINGS   = { "8", "9", "10", "11", "12", "14", "16", "18", "20", "22", "24", "26", "28", "36","48", "72", };

    protected int                   m_dialogResultValue         = ERROR_OPTION;

    private String[]                m_fontStyleNames            = null;
    private String[]                m_fontFamilyNames           = null;
    private String[]                m_fontSizeStrings           = null;
    private JTextField              m_fontFamilyTextField       = null;
    private JTextField              m_fontStyleTextField        = null;
    private JTextField              m_fontSizeTextField         = null;
    private JList                   m_fontNameList              = null;
    private JList                   m_fontStyleList             = null;
    private JList                   m_fontSizeList              = null;
    private JPanel                  m_fontNamePanel             = null;
    private JPanel                  m_fontStylePanel            = null;
    private JPanel                  m_fontSizePanel             = null;
    private JPanel                  m_samplePanel               = null;
    private JButton                 m_colorButon                = new JButton();
    private JTextField              m_sampleText                = null;


    public JFontChooser ()
    {
        this(DEFAULT_FONT_SIZE_STRINGS);
    }

    public JFontChooser (String[] fontSizeStrings) 
    {
        if (fontSizeStrings == null) 
        {
            fontSizeStrings = DEFAULT_FONT_SIZE_STRINGS;
        }
        this.m_fontSizeStrings  = fontSizeStrings;

        JPanel selectPanel      = new JPanel();
        
        selectPanel.setLayout(new BoxLayout(selectPanel, BoxLayout.X_AXIS));
        selectPanel.add(getFontFamilyPanel());
        selectPanel.add(getFontStylePanel());
        selectPanel.add(getFontSizePanel());

        JPanel contentsPanel    = new JPanel();
        
        contentsPanel.setLayout(new GridLayout(2, 1));
        contentsPanel.add(selectPanel, BorderLayout.NORTH);
        contentsPanel.add(getSamplePanel(), BorderLayout.CENTER);

        this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
        this.add(contentsPanel);
        this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    }

    public JTextField getFontFamilyTextField () 
    {
        if (m_fontFamilyTextField == null) 
        {
            m_fontFamilyTextField = new JTextField();
            m_fontFamilyTextField.addFocusListener(new TextFieldFocusHandlerForTextSelection(m_fontFamilyTextField));
            m_fontFamilyTextField.addKeyListener(new TextFieldKeyHandlerForListSelectionUpDown(getFontFamilyList()));
            m_fontFamilyTextField.getDocument().addDocumentListener(new ListSearchTextFieldDocumentHandler(getFontFamilyList()));
            m_fontFamilyTextField.setFont(DEFAULT_FONT);
        }
      return m_fontFamilyTextField;
    }

    public JTextField getFontStyleTextField () 
    {
        if (m_fontStyleTextField == null) 
        {
            m_fontStyleTextField = new JTextField();
            m_fontStyleTextField.addFocusListener(new TextFieldFocusHandlerForTextSelection(m_fontStyleTextField));
            m_fontStyleTextField.addKeyListener(new TextFieldKeyHandlerForListSelectionUpDown(getFontStyleList()));
            m_fontStyleTextField.getDocument().addDocumentListener(new ListSearchTextFieldDocumentHandler(getFontStyleList()));
            m_fontStyleTextField.setFont(DEFAULT_FONT);
        }
        return m_fontStyleTextField;
    }

    public JTextField getFontSizeTextField ()
    {
        if (m_fontSizeTextField == null) 
        {
            m_fontSizeTextField = new JTextField();
            m_fontSizeTextField.addFocusListener(new TextFieldFocusHandlerForTextSelection(m_fontSizeTextField));
            m_fontSizeTextField.addKeyListener(new TextFieldKeyHandlerForListSelectionUpDown(getFontSizeList()));
            m_fontSizeTextField.getDocument().addDocumentListener(new ListSearchTextFieldDocumentHandler(getFontSizeList()));
            m_fontSizeTextField.setFont(DEFAULT_FONT);
        }
        return m_fontSizeTextField;
    }

    public JList getFontFamilyList () 
    {
      if (m_fontNameList == null) 
      {
          m_fontNameList = new JList(getFontFamilies());
          m_fontNameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
          m_fontNameList.addListSelectionListener(new ListSelectionHandler(getFontFamilyTextField()));
          m_fontNameList.setSelectedIndex(0);
          m_fontNameList.setFont(DEFAULT_FONT);
          m_fontNameList.setFocusable(false);
      }      
      return m_fontNameList;
    }

    public JList getFontStyleList () 
    {
        if (m_fontStyleList == null) 
        {
            m_fontStyleList = new JList(getFontStyleNames());
            m_fontStyleList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
            m_fontStyleList.addListSelectionListener(new ListSelectionHandler(getFontStyleTextField()));
            m_fontStyleList.setSelectedIndex(0);
            m_fontStyleList.setFont(DEFAULT_FONT);
            m_fontStyleList.setFocusable(false);
        }
        return m_fontStyleList;
    }

    public JList getFontSizeList () 
    {
        if (m_fontSizeList == null) 
        {
            m_fontSizeList = new JList(this.m_fontSizeStrings);
            m_fontSizeList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
            m_fontSizeList.addListSelectionListener(new ListSelectionHandler(getFontSizeTextField()));
            m_fontSizeList.setSelectedIndex(0);
            m_fontSizeList.setFont(DEFAULT_FONT);
            m_fontSizeList.setFocusable(false);
        }
        return m_fontSizeList;
    }

    public String getSelectedFontFamily () 
    {
        String fontName = (String) getFontFamilyList().getSelectedValue();
        return fontName;
    }
    
    public int getSelectedFontStyle () 
    {
        int index = getFontStyleList().getSelectedIndex();
        return FONT_STYLE_CODES[index];
    }

    public int getSelectedFontSize () 
    {
        int fontSize = 1;
        String fontSizeString = getFontSizeTextField().getText();
        while (true) 
        {
          try 
          {
              fontSize = Integer.parseInt(fontSizeString);
              break;
          } 
          catch (NumberFormatException e) 
          {
              fontSizeString = (String) getFontSizeList().getSelectedValue();
              getFontSizeTextField().setText(fontSizeString);
          }
        }
        return fontSize;
    }

    public Font getSelectedFont () 
    {
        Font font = new Font(getSelectedFontFamily(), getSelectedFontStyle(),
        getSelectedFontSize());
        
        return font;
    }

    public Color getSelectdeColor () 
    {
        return m_colorButon.getBackground();
    }
    
    public void setSelectedFontFamily (String name) 
    {
        String[] names = getFontFamilies();
        for (int i = 0; i < names.length; i++) 
        {
            if (names[i].toLowerCase().equals(name.toLowerCase())) 
            {
                getFontFamilyList().setSelectedIndex(i);
                break;
            }
      }
      updateSampleFont();
    }

    public void setSelectedFontStyle (int style) 
    {
        for (int i = 0; i < FONT_STYLE_CODES.length; i++) 
        {
            if (FONT_STYLE_CODES[i] == style) 
            {
                getFontStyleList().setSelectedIndex(i);
                break;
            }
        }
        updateSampleFont();
    }

    public void setSelectedFontSize (int size)
    {
        String sizeString = String.valueOf(size);
        for (int i = 0; i < this.m_fontSizeStrings.length; i++) 
        {
            if (this.m_fontSizeStrings[i].equals(sizeString)) 
            {
                getFontSizeList().setSelectedIndex(i);
                break;
            }
        }
        getFontSizeTextField().setText(sizeString);
        updateSampleFont();
    }

    public void setSelectedFont (Font font) 
    {
        setSelectedFontFamily(font.getFamily());
        setSelectedFontStyle(font.getStyle());
        setSelectedFontSize(font.getSize());
    }

    public void setSelectdeColor (Color color)
    {
        this.m_colorButon.setBackground(color);
    }

    public String getVersionString ()
    {
        return "1.0";
    }

    public int showDialog (Component parent) 
    {
        m_dialogResultValue = ERROR_OPTION;
        JDialog dialog      = createDialog(parent);
        
        dialog.addWindowListener(new WindowAdapter() 
        {
            public void windowClosing(WindowEvent e) 
            {
                m_dialogResultValue = CANCEL_OPTION;
            }
        });
        
        dialog.setVisible(true);
        dialog.dispose();
        dialog = null;

        return m_dialogResultValue;
    }

    protected class ListSelectionHandler implements ListSelectionListener 
    {
        private JTextComponent textComponent;

        ListSelectionHandler(JTextComponent textComponent) 
        {
            this.textComponent = textComponent;
        }

        public void valueChanged (ListSelectionEvent e)
        {
            if (e.getValueIsAdjusting() == false) 
            {
                JList list              = (JList) e.getSource();
                String selectedValue    = (String) list.getSelectedValue();
                String oldValue         = textComponent.getText();
                textComponent.setText(selectedValue);
                
                if (!oldValue.equalsIgnoreCase(selectedValue)) 
                {
                    textComponent.selectAll();
                    textComponent.requestFocus();
                }
                updateSampleFont();
            }
        }
    }

    protected class TextFieldFocusHandlerForTextSelection extends FocusAdapter
    {
        private JTextComponent textComponent;

        public TextFieldFocusHandlerForTextSelection (JTextComponent textComponent) 
        {
            this.textComponent = textComponent;
        }

        public void focusGained (FocusEvent e) 
        {
            textComponent.selectAll();
        }

        public void focusLost (FocusEvent e) 
        {
            textComponent.select(0, 0);
            updateSampleFont();
        }
    }

    protected class TextFieldKeyHandlerForListSelectionUpDown extends KeyAdapter 
    {
        private JList targetList;

        public TextFieldKeyHandlerForListSelectionUpDown (JList list) 
        {
          this.targetList = list;
        }

        public void keyPressed (KeyEvent e)
        {
            int i = targetList.getSelectedIndex();
            switch (e.getKeyCode()) 
            {
                case KeyEvent.VK_UP:
                    i = targetList.getSelectedIndex() - 1;
                    if (i < 0) 
                    {
                        i = 0;
                    }
                    targetList.setSelectedIndex(i);
                    break;
                case KeyEvent.VK_DOWN:
                    int listSize = targetList.getModel().getSize();
                    i = targetList.getSelectedIndex() + 1;
                    if (i >= listSize) 
                    {
                        i = listSize - 1;
                    }
                    targetList.setSelectedIndex(i);
                    break;
                default:
                    break;
            }
        }
    }

    protected class ListSearchTextFieldDocumentHandler implements DocumentListener 
    {
        JList targetList;

        public ListSearchTextFieldDocumentHandler (JList targetList) 
        {
            this.targetList = targetList;
        }

        public void insertUpdate (DocumentEvent e) 
        {
            update(e);
        }

        public void removeUpdate (DocumentEvent e) 
        {
            update(e);
        }

        public void changedUpdate (DocumentEvent e) 
        {
            update(e);
        }

        private void update (DocumentEvent event) 
        {
            String newValue = "";
            try 
            {
                Document doc = event.getDocument();
                newValue = doc.getText(0, doc.getLength());
            } 
            catch (BadLocationException e) 
            {
                e.printStackTrace();
            }
            
            if (newValue.length() > 0) 
            {
                int index = targetList.getNextMatch(newValue, 0,Position.Bias.Forward);
                if (index < 0) 
                {
                  index = 0;
                }
                targetList.ensureIndexIsVisible(index);
                
                String matchedName = targetList.getModel().getElementAt(index).toString();
                if (newValue.equalsIgnoreCase(matchedName)) 
                {
                    if (index != targetList.getSelectedIndex()) 
                    {
                        SwingUtilities.invokeLater(new ListSelector(index));
                    }
                }
            }
        }

        public class ListSelector implements Runnable 
        {
            private int index;
            public ListSelector(int index) 
            {
                this.index = index;
             }
             public void run () 
             {
                targetList.setSelectedIndex(this.index);
             }
         }
     }

    protected class DialogOKAction extends AbstractAction 
    {
        protected static final String ACTION_NAME = "OK";
        private JDialog dialog;

        protected DialogOKAction (JDialog dialog) 
        {
            this.dialog = dialog;
            putValue(Action.DEFAULT, ACTION_NAME);
            putValue(Action.ACTION_COMMAND_KEY, ACTION_NAME);
            putValue(Action.NAME, "OK");
        }

        public void actionPerformed (ActionEvent e) 
        {
            m_dialogResultValue = OK_OPTION;
            dialog.setVisible(false);
        }
    }

    protected class DialogCancelAction extends AbstractAction 
    {
        protected static final String ACTION_NAME = "Cancel";
        private JDialog dialog;

        protected DialogCancelAction (JDialog dialog) 
        {
            this.dialog = dialog;
            putValue(Action.DEFAULT, ACTION_NAME);
            putValue(Action.ACTION_COMMAND_KEY, ACTION_NAME);
            putValue(Action.NAME, "Cancel");
        }

        public void actionPerformed (ActionEvent e) 
        {
            m_dialogResultValue = CANCEL_OPTION;
            dialog.setVisible(false);
        }
    }

    protected JDialog createDialog (Component parent) 
    {
        Frame frame             = parent instanceof Frame ? (Frame) parent : (Frame) SwingUtilities.getAncestorOfClass(Frame.class, parent);
        
        JDialog dialog          = new JDialog(frame, "SelectFont", true);

        Action okAction         = new DialogOKAction(dialog);
        Action cancelAction     = new DialogCancelAction(dialog);
        
        JButton okButton        = new JButton(okAction);
        
        okButton.setFont(DEFAULT_FONT);
        JButton cancelButton    = new JButton(cancelAction);
        cancelButton.setFont(DEFAULT_FONT);

        JPanel buttonsPanel     = new JPanel();
        buttonsPanel.setLayout(new GridLayout(2, 1));
        buttonsPanel.add(okButton);
        buttonsPanel.add(cancelButton);
        buttonsPanel.setBorder(BorderFactory.createEmptyBorder(25, 0, 10, 10));

        ActionMap actionMap     = buttonsPanel.getActionMap();
        actionMap.put(cancelAction.getValue(Action.DEFAULT), cancelAction);
        actionMap.put(okAction.getValue(Action.DEFAULT), okAction);
        InputMap inputMap = buttonsPanel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
        inputMap.put(KeyStroke.getKeyStroke("ESCAPE"),cancelAction.getValue(Action.DEFAULT));
        inputMap.put(KeyStroke.getKeyStroke("ENTER"), okAction.getValue(Action.DEFAULT));

        JPanel dialogEastPanel   = new JPanel();
        dialogEastPanel.setLayout(new BorderLayout());
        dialogEastPanel.add(buttonsPanel, BorderLayout.NORTH);
        dialog.getContentPane().add(this, BorderLayout.CENTER);
        dialog.getContentPane().add(dialogEastPanel, BorderLayout.EAST);
        dialog.pack();
        dialog.setLocationRelativeTo(frame);
        
        return dialog;
    }

    protected void updateSampleFont () 
    {
        Font font = getSelectedFont();
        getSampleTextField().setForeground(this.m_colorButon.getBackground());
        getSampleTextField().setFont(font);
    }

    protected JPanel getFontFamilyPanel () 
    {
        if (m_fontNamePanel == null) 
        {
              m_fontNamePanel = new JPanel();
              m_fontNamePanel.setLayout(new BorderLayout());
              m_fontNamePanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
              m_fontNamePanel.setPreferredSize(new Dimension(180, 150));

              JScrollPane scrollPane = new JScrollPane(getFontFamilyList());
              scrollPane.getVerticalScrollBar().setFocusable(false);
              scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

              JPanel p = new JPanel();
              p.setLayout(new BorderLayout());
              p.add(getFontFamilyTextField(), BorderLayout.NORTH);
              p.add(scrollPane, BorderLayout.CENTER);

              JLabel label = new JLabel("FontName");
              label.setHorizontalAlignment(JLabel.LEFT);
              label.setHorizontalTextPosition(JLabel.LEFT);
              label.setLabelFor(getFontFamilyTextField());
              label.setDisplayedMnemonic('F');

              m_fontNamePanel.add(label, BorderLayout.NORTH);
              m_fontNamePanel.add(p, BorderLayout.CENTER);
        }
        return m_fontNamePanel;
    }

    protected JPanel getFontStylePanel () 
    {
        if (m_fontStylePanel == null) 
        {
            m_fontStylePanel = new JPanel();
            m_fontStylePanel.setLayout(new BorderLayout());
            m_fontStylePanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
            m_fontStylePanel.setPreferredSize(new Dimension(140, 150));

            JScrollPane scrollPane = new JScrollPane(getFontStyleList());
            scrollPane.getVerticalScrollBar().setFocusable(false);
            scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

            JPanel p = new JPanel();
            p.setLayout(new BorderLayout());
            p.add(getFontStyleTextField(), BorderLayout.NORTH);
            p.add(scrollPane, BorderLayout.CENTER);

            JLabel label = new JLabel("FontStyle");
            label.setHorizontalAlignment(JLabel.LEFT);
            label.setHorizontalTextPosition(JLabel.LEFT);
            label.setLabelFor(getFontStyleTextField());
            label.setDisplayedMnemonic('Y');

            m_fontStylePanel.add(label, BorderLayout.NORTH);
            m_fontStylePanel.add(p, BorderLayout.CENTER);
        }
        
        return m_fontStylePanel;
    }

    protected JPanel getFontSizePanel () 
    {
        if (m_fontSizePanel == null) 
        {
            m_fontSizePanel = new JPanel();
            m_fontSizePanel.setLayout(new BorderLayout());
            m_fontSizePanel.setPreferredSize(new Dimension(70, 150));
            m_fontSizePanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

            JScrollPane scrollPane = new JScrollPane(getFontSizeList());
            scrollPane.getVerticalScrollBar().setFocusable(false);
            scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

            JPanel p = new JPanel();
            p.setLayout(new BorderLayout());
            p.add(getFontSizeTextField(), BorderLayout.NORTH);
            p.add(scrollPane, BorderLayout.CENTER);

            JLabel label = new JLabel("FontSize");
            label.setHorizontalAlignment(JLabel.LEFT);
            label.setHorizontalTextPosition(JLabel.LEFT);
            label.setLabelFor(getFontSizeTextField());
            label.setDisplayedMnemonic('S');

            m_fontSizePanel.add(label, BorderLayout.NORTH);
            m_fontSizePanel.add(p, BorderLayout.CENTER);
        }
        return m_fontSizePanel;
    }

    protected JPanel getSamplePanel () 
    {
        if (m_samplePanel == null) 
        {
            JPanel textContainer = new JPanel(new GridBagLayout());

            Border titledBorder = BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Write your text Here");
            Border empty = BorderFactory.createEmptyBorder(5, 10, 10, 10);
            Border border = BorderFactory.createCompoundBorder(titledBorder,empty);
            m_samplePanel = new JPanel(new BorderLayout());
            
            textContainer.setLayout(new BorderLayout());
            textContainer.setBorder(border);
            textContainer.add(getSampleTextField(), BorderLayout.CENTER);

            JPanel color = new JPanel(new FlowLayout());
            color.add(new Label("Select color :"), BorderLayout.NORTH);
            color.add(this.m_colorButon, BorderLayout.NORTH);

            m_samplePanel.add(color, BorderLayout.NORTH);
            m_samplePanel.add(textContainer, BorderLayout.CENTER);

            final JFontChooser me = this;

            this.m_colorButon.setBackground(Color.BLACK);

            updateSampleFont();

            this.m_colorButon.addActionListener(new ActionListener() 
            {
                  @Override
                  public void actionPerformed (ActionEvent e)
                  {
                      final JColorChooser colorChooser = new JColorChooser();

                      Color newColor = colorChooser.showDialog(me, "color Chooser",  m_colorButon.getBackground());

                      m_colorButon.setBackground(newColor);
                      m_colorButon.repaint();

                      updateSampleFont();
                  }
            });
        }
        return m_samplePanel;
    }

    protected JTextField getSampleTextField () 
    {
       if (m_sampleText == null) 
       {
          Border lowered = BorderFactory.createLoweredBevelBorder();
          m_sampleText = new JTextField("Write your text Here");
          m_sampleText.setBorder(lowered);
          m_sampleText.setPreferredSize(new Dimension(300, 80));
       }
       return m_sampleText;
    }
    
    public String getSampleText ()
    {
        if(m_sampleText != null)
        {
            return m_sampleText.getText();
        }
        return null;
    }
    
    public void setSampleText (String text)
    {
        if(m_sampleText != null)
        {
            m_sampleText.setText(text);
        }
    }

    protected String[] getFontFamilies() 
    {
        if (m_fontFamilyNames == null) 
        {
            GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
            m_fontFamilyNames = env.getAvailableFontFamilyNames();
        }
        return m_fontFamilyNames;
    }

    protected String[] getFontStyleNames() 
    {
        if (m_fontStyleNames == null) 
        {
            int i = 0;
            m_fontStyleNames = new String[4];
            m_fontStyleNames[i++] = "Plain";
            m_fontStyleNames[i++] = "Bold";
            m_fontStyleNames[i++] = "Italic";
            m_fontStyleNames[i++] = "BoldItalic";
        }
        return m_fontStyleNames;
    }

    public String getSelectedFontDesp () 
    {
        Font selectedFont = getSelectedFont();
        if (selectedFont != null) 
        {
             return selectedFont.getName() + " " + m_fontStyleNames[selectedFont.getStyle()] + " " + selectedFont.getSize();
        }
        return "";
    }
}